<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>11-命名视图demo</title>
</head>
<body>
  <div id="app">
    <h1>Hello VueRouter</h1>
    <router-link to='/user'>导航一</router-link>
    <router-link to='/user'>导航二</router-link>
    <router-view></router-view>
    <hr>
    <router-view name='rwa'></router-view>
  </div>
</body>
<!-- 引入Vue -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- 引入VueRouter -->
<script src="https://unpkg.com/vue-router@3.5.1/dist/vue-router.js"></script>
<script>
  const User={
    template:`<div>
        <h1>这里是 User 组件</h1>
        <h2>这里是 User 组件</h2>
      </div>`
  }
  var routes =[
    {path:'',component: User },
    {path:'/user',components:{
      default: User,
      rwa: User,
    }}
  ];
  var router = new VueRouter({
    routes
  });
  var app = new Vue({
    el:'#app',
    router,
  })
</script>
</html>